#ifndef _RETRO_EDITSURFACE
#define _RETRO_EDITSURFACE

namespace Retro
{
  namespace Creator
  {
    namespace Editor
    {
      class EditSurface : public Windows::Window
      {
      private:
        ScrollInfo          scroll;
        MapEditor*          editor;

        INT calcScrollPos(INT sbRequest, INT nBar, INT current);

      protected:
        virtual VOID  onSize(Event::SizeEvent& iEvent);
        virtual VOID  onHScroll(Event::ScrollEvent& iEvent);
        virtual VOID  onVScroll(Event::ScrollEvent& iEvent);
        virtual VOID  onPaint();
        virtual VOID  onEraseBackground(Event::EraseBackgroundEvent& iEvent);
        virtual VOID  onMouseDown(Event::MouseEvent& iEvent);

      public:
        VOID  updateScroll();
        VOID  scrollToPoint(const Geom::Point& pt);

        VOID  setScrollX(INT value);
        VOID  setScrollY(INT value);

        INLC Geom::Point&   getScroll()
        {
          return scroll.pos;
        }
        INLC Geom::Point&   getScrollMax()
        {
          return scroll.max;
        }

        INL MapEditor*  getEditor()
        {
          return editor;
        }
        INL VOID  setEditor(MapEditor* value)
        {
          editor = value;
          updateScroll();
          invalidate();
        }

        EditSurface();
      };
    } // namespace Editor
  } // namespace Creator
} // namespace Retro

#endif